package com.app.micaihu.bean.game;

import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.app.micaihu.R;

/**
 * Created by linkai on 2017/3/14.
 */
public class ViewGameParent {

    private TextView titleView;//标题
    private TextView descView;//描述

    /**
     * 初始化控件
     * @param convertView
     */
    protected void  initView(View convertView){
        titleView = (TextView) convertView.findViewById(R.id.item_public_title);
        descView = (TextView) convertView.findViewById(R.id.item_public_desc);
    }

    /**
     * 加载数据
     * @param gameRaidersEntity
     */
    public void loadData(GameRaidersEntity gameRaidersEntity) {
        this.titleView.setText(gameRaidersEntity.getArticleTitle());
        if(TextUtils.isEmpty(gameRaidersEntity.getArticleSummary())){
            this.descView.setVisibility(View.GONE);
        }else if(this.descView.getVisibility() == View.GONE){
            this.descView.setVisibility(View.VISIBLE);
            this.descView.setText(gameRaidersEntity.getArticleSummary());
        }else{
            this.descView.setText(gameRaidersEntity.getArticleSummary());
        }
    }
}
